package com.study.webapp.springThink.lookup;

import javafx.beans.property.ObjectProperty;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;

/**
 * @program: study
 *
 * @description:
 *
 * @author: heqiang
 *
 * @create: 2020-06-27 20:38
 **/
public class ObjectProviderDemo {

    public static void main(String[] args) {
        AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext();
        //将当前类作为配置类
        applicationContext.register(ObjectProviderDemo.class);
        //启动
        applicationContext.refresh();
        lookupByObjectProvider(applicationContext);
        //关闭应用上下文
        applicationContext.close();
    }

    @Bean
    public String helloWOrd() {
        return "Hello Word";
    }

    private static void lookupByObjectProvider(AnnotationConfigApplicationContext applicationContext) {
//        ObjectProvider<String> objectProvider = applicationContext.getBeanProvider(String.class);
//        System.out.println(objectProvider.getObject());
    }
}
